package router

import (
	"github.com/gin-gonic/gin"
	"user_bff/controller"
	"user_bff/middleware"
)

func InitRouter() *gin.Engine {
	router := gin.Default()
	v1 := router.Group("user")
	{
		v1.POST("", controller.UserRegister)        //用户注册
		v1.POST("login", controller.UserLogin)      //用户登录
		v1.POST("refresh", controller.RefreshToken) //刷新令牌
		v1.GET("", controller.UserList)
	}
	router.GET("/health", controller.Health) //健康检测
	router.Use(middleware.CheckUserLogin())
	router.POST("/captcha", controller.Captcha)                 //图形验证码
	router.POST("/update/user_info", controller.UpdateUserInfo) //修改用户信息
	return router
}
